<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>web worker学习</title>
</head>

<body>

</body>
<script>
    let worker1 = new Worker("worker.js")
    console.log('worker1:', worker1)

    worker1.onmessage = (event) => {
        console.log(event.data)
    } 

    // function fb(n) {
    //     if (n === 1 || n === 2) {
    //         return 1
    //     }
    //     return fb(n - 1) + fb(n - 2)
    // }

    // console.time('fb执行时间1')
    // var result = fb(45)
    // console.timeEnd('fb执行时间1')
</script>

</html>